package top.yongyan0624.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.ServletRequestUtils;
import top.yongyan0624.service.*;
import top.yongyan0624.utils.RedisUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Yongyan
 * @description: TODO
 * @date 2021/8/15
 **/
public class BaseController {
    @Autowired
    HttpServletRequest req;

    @Autowired
    RedisUtils redisUtils;

    @Autowired
    SysUserService sysUserService;

    @Autowired
    SysRoleService sysRoleService;

    @Autowired
    SysMenuService sysMenuService;

    @Autowired
    SysUserRoleService sysUserRoleService;

    @Autowired
    SysRoleMenuService sysRoleMenuService;

    @Autowired
    NannyService nannyService;

    @Autowired
    NannyTypeService nannyTypeService;

    /**
     * 获取页面
     * @return page对象
     */
    public Page getPage() {
        int current = ServletRequestUtils.getIntParameter(req, "current", 1);
        int size = ServletRequestUtils.getIntParameter(req, "size", 10);

        return new Page(current, size);
    }
}
